export type ObjectT = Record<string, number | string | null | undefined>

interface AndWhereT {
  AND?: BaseWhereT | AndWhereT
  OR?: BaseWhereT | AndWhereT
}

// 可以对比大小的数据类型
type canMathT = number | Date | string | HSqlObjectT

type allWhereT =
  | undefined
  | null
  | boolean
  | Date
  | number
  | number[]
  | string
  | string[]
  | BaseWhereT
  | OperatorWhere
  | HSqlObjectT

// 可以含操作符的类型
interface OperatorWhere {
  in?: allWhereT
  'not in'?: allWhereT
  '!'?: allWhereT
  '!='?: allWhereT
  '>='?: canMathT
  '>'?: canMathT
  '<'?: canMathT
  '<='?: canMathT
  '='?: canMathT
}

interface BaseWhereT {
  [k: string]: allWhereT
}

export interface WhereObjectT extends AndWhereT {
  'LEFT JOIN'?: string | string[]
  AS?: string
}

// 最外层where允许的属性
export type WhereT = WhereObjectT & BaseWhereT

export interface HSqlObjectT {
  sql: string
  values: (string | number)[]
  symbol: string[]
}
